package org.argetr.resim.proc.view;

import org.argetr.resim.proc.ConnectionRule;
import org.argetr.resim.proc.Processor;
import org.argetr.resim.proc.data.Data;
import org.argetr.resim.proc.data.ExtremaDA;
import org.argetr.resim.proc.data.HistogramDA;
import org.argetr.resim.proc.data.ImageDA;


public class ViewerPR extends Processor {
	protected void setConnectionRules(ConnectionRule connRule){
		connRule.addInType(HistogramDA.class, 0);
		connRule.addInType(ImageDA.class, 0);
		connRule.addInType(ExtremaDA.class, 0);
	}
	public Data process() {
	   Processor pr = getProcessor();
	   pr.process();
	   return null;
    }
	private Processor getProcessor() {
		Processor pr = null;
		Data input = getInput();
		if(input.isOfType(Data.IMAGE)){
			pr = new ImgViewerPR();		
		}else if(input.isOfType(Data.HISTOGRAM)){
			pr = new HistogramViewerPR();
		}else if(input.isOfType(Data.EXTREMA)){
			pr = new ExtremaViewerPR();
		}
		pr.setInput(input);
		return pr;
	}
}
